package com.example.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserResult {
    private String code;//响应码，1 代表成功; 0 代表失败
    private String msg;  //响应信息 描述字符串
    private Object result; //返回的数据


    //增删改 成功响应
    public static UserResult success(){
        return new UserResult("1","操作成功",null);
    }
    //查询 成功响应
    public static UserResult success(Object result){
        return new UserResult("1","操作成功",result);
    }
    //失败响应
    public static UserResult error(String msg){
        return new UserResult("1",msg,null);
    }
}
